<template>
  <el-select :value="value" placeholder="请选择仓库" style="width: 100%;" @change="updavalue">
    <el-option
      v-for="item in cangkulist"
      :key="item.Id"
      :label="item.Name"
      :value="item.Id"
    />
  </el-select>
</template>

<script>
import { getWarehouseList } from '@/api/huoqu'
export default {
  props: {
    value: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      cangkulist: [{}]
    }
  },
  created() {
    this.getCangkuList()
  },
  methods: {
    async getCangkuList() {
      const res = await getWarehouseList()
      console.log('仓库列表', res)
      this.cangkulist = res
    },
    updavalue(val) {
      console.log(val)
      this.$emit('input', val)
    }
  }
}
</script>
